package com.solocredit.finance.ui.loan.adapter

import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.solocredit.finance.R
import com.solocredit.finance.base.adapter.MullaRecyclerViewAdapter
import com.solocredit.finance.base.adapter.MullaViewHolderHelper
import com.solocredit.finance.base.utils.ImageUtil
import org.json.JSONObject

/**
 * MullaFlow
 * @Author wwdeng
 * @CreateTime: 2024/8/21 11:51
 * @Annotation：贷款详情 - 账户列表
 */
class MullaLoanDetailsAccountAdapter(recyclerView: RecyclerView?) : MullaRecyclerViewAdapter<JSONObject>(recyclerView, R.layout.item_mulla_account) {
    override fun setItemChildListener(helper: MullaViewHolderHelper, viewType: Int) {
        helper.setItemChildClickListener(R.id.itemLayout) //点击Item
    }
    override fun fillData(helper: MullaViewHolderHelper, position: Int, model: JSONObject) {
        var showName = model.optString("name","")
        if (showName.isEmpty() || showName == "null"){
            showName = "test"
        }
        helper.setText(R.id.textName,showName)
        helper.setText(R.id.textNumber,"+" + model.optString("account"))
        val imgLogo = helper.getImageView(R.id.imgLogo)
        ImageUtil.instance?.loadImageUrl(mContext,imgLogo,model.optString("logo"), R.mipmap.icon_holder)

        //不显示删除
        helper.setVisibility(R.id.imgDelete, View.GONE)
    }
}